<template>
    <div id="A">
        A
        <B></B>
    </div>
</template>

 <script setup lang="ts">
import { provide, ref } from 'vue'
import B from './B.vue';

let value = ref('你好呀')
// 通过provide可以向它的后代组件共享一个数据
provide('data', value)

</script>

<style lang="less" scoped>
#A {
    background-color: red;
    width: 400px;
    height: 300px;
}
</style>